VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3090
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3090
   ScaleWidth      =   4680
   StartUpPosition =   3  'Windows Default
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_KeyPress(KeyAscii As Integer)
Term
Unload Me
End
End Sub

Private Sub Form_Load()
Dim c As CONST_D3DPRIMITIVETYPE
c = D3DPT_POINTLIST
Debug.Print c
c = D3DPT_LINELIST
Debug.Print c
c = D3DPT_LINESTRIP
Debug.Print c
c = D3DPT_TRIANGLELIST
Debug.Print c
c = D3DPT_TRIANGLESTRIP
Debug.Print c
c = D3DPT_TRIANGLEFAN
Debug.Print c

Init Form1.Hwnd 'Initialize directX
ReDim Textures(0)
ReDim Texlastused(0)
'Loadtex 0
ReDim Vertex_List(7)
Vertex_List(0) = Create_TLVertex(0, 0, 0, 1, D3DColorRGBA(255, 255, 255, 0), 0, 0, 0)
Vertex_List(1) = Create_TLVertex(100, 0, 0, 1, D3DColorRGBA(255, 255, 255, 0), 0, 1, 0)
Vertex_List(2) = Create_TLVertex(0, 100, 0, 1, D3DColorRGBA(255, 255, 255, 0), 0, 0, 1)
Vertex_List(3) = Create_TLVertex(100, 100, 0, 1, D3DColorRGBA(255, 255, 255, 0), 0, 1, 1)
Vertex_List(4) = Create_TLVertex(110, 100, 0, 1, D3DColorRGBA(255, 255, 255, 0), 0, 0, 0)
Vertex_List(5) = Create_TLVertex(210, 100, 0, 1, D3DColorRGBA(255, 255, 255, 0), 0, 1, 0)
Vertex_List(6) = Create_TLVertex(110, 200, 0, 1, D3DColorRGBA(255, 255, 255, 0), 0, 0, 1)
Vertex_List(7) = Create_TLVertex(210, 200, 0, 1, D3DColorRGBA(255, 255, 255, 0), 0, 1, 1)

    '---------------------------------------------------------------
    
    'Creates the vertex buffer.
    Set Vertex_Buffer = Direct3D_Device.CreateVertexBuffer(Len(Vertex_List(0)) * (UBound(Vertex_List) + 1), 0, FVF_TLVERTEX, D3DPOOL_MANAGED)
    
    
    D3DVertexBuffer8SetData Vertex_Buffer, 0, Len(Vertex_List(0)) * (UBound(Vertex_List) + 1), 0, Vertex_List(0)
    
    'Sets the stream source for the vertex buffer.
    Direct3D_Device.SetStreamSource 0, Vertex_Buffer, Len(Vertex_List(0))
    

    Direct3D_Device.SetVertexShader FVF_TLVERTEX 'Set the type of vertex shading. (Required)
    
    Running = True 'Initializations all set. It's now ok to activate the game loop.

    Do While Running = True
        
        DoEvents 'Allow events to happen so the program doesn't lock up.
        
        'Clears the backbuffer.
        Direct3D_Device.Clear 0, ByVal 0, D3DCLEAR_TARGET, D3DColorRGBA(100, 100, 100, 255), 1#, 0
        
        Direct3D_Device.BeginScene 'Start the scene
        
        'Rendering code goes here.
        
        If Textures(0) Is Nothing Then Loadtex 0
        Direct3D_Device.SetTexture 0, Textures(0)
        
        Texlastused(0) = Timer
        
        
        
        Direct3D_Device.DrawPrimitive D3DPT_TRIANGLESTRIP, 0, UBound(Vertex_List)  '2
        
        'End the scene and flip it to the frontbuffer
        Direct3D_Device.EndScene
        Direct3D_Device.Present ByVal 0, ByVal 0, 0, ByVal 0
        
    Loop
    
Term
Unload Me

End
End Sub

